﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;

namespace DoAn_BumTruong_DesignPattern
{
    class ArticleProxy : Abstract
    {
        ArticleController arctrl;
        //Paging theo ID
        //public Article SelectByArticleID(string articleID)
        //{
        //    if (arctrl == null)
        //    {
        //        arctrl = new ArticleController();
        //    }
        //    return arctrl.SelectByArticleID(articleID);
        //}
        public List<Article> SelectByArticleID(string articleID)
        {
            if (arctrl == null)
            {
                arctrl = new ArticleController();
            }
            return arctrl.SelectByArticleID(articleID);
        }
        /// <summary>
        /// 
        /// </summary>
        /// <param name="page"></param>
        /// <param name="howManyPage"></param>
        /// <returns></returns>
        public List<Article> Paging(string page, out int howManyPage)
        {
            if (arctrl == null)
            {
                arctrl = new ArticleController();
            }
            return arctrl.Paging(page, out howManyPage);
        }
        public List<Article> PagingByMenuID(string menuID, string page, out int howManyPage)
        {
            if (arctrl == null)
            {
                arctrl = new ArticleController();
            }
            return arctrl.PagingByMenuID(menuID, page, out howManyPage);
        }
        //Search
        public List<Article> PagingBySearchName(string title, string page, out int howManyPage)
        {
            if (arctrl == null)
            {
                arctrl = new ArticleController();
            }
            return arctrl.PagingByMenuID(title, page, out howManyPage);
        }
        //Search MasterPage
        public List<Article> SearchTitle(string title)
        {
            if (arctrl == null)
            {
                arctrl = new ArticleController();
            }
            return arctrl.SearchName(title);
        }
        public override bool Add(object o)
        {
            throw new NotImplementedException();
        }

        public override bool Delete(object o)
        {
            throw new NotImplementedException();
        }

        public override bool Update(object o)
        {
            throw new NotImplementedException();
        }
    }
}